﻿using MathematicallySafe.Base;
using MathematicallySafe.HeadCounter.Data;
using MathematicallySafe.HeadCounter.Services;
using MathematicallySafe.HeadCounter.Services.Backup;
using MathematicallySafe.HeadCounter.Services.Calculators;
using MathematicallySafe.HeadCounter.Services.Exporters;
using MathematicallySafe.HeadCounter.Services.Forums;
using MathematicallySafe.HeadCounter.Services.Publishers;
using StructureMap;
using StructureMap.Configuration.DSL;
using StructureMap.Pipeline;

namespace MathematicallySafe.HeadCounter
{
    public class HeadCounterRegistry: Registry
    {
        public HeadCounterRegistry()
        {
            For(typeof(IAppLog<>)).LifecycleIs(Lifecycles.GetLifecycle(InstanceScope.Singleton)).Use(typeof(Log4NetLog<>));
            For<IHeadCounterService>().LifecycleIs(Lifecycles.GetLifecycle(InstanceScope.Singleton)).Use<HeadCounterService>();
            For<ICalculationService>().LifecycleIs(Lifecycles.GetLifecycle(InstanceScope.Singleton)).Use<CalculationService>();
            For<IBackupService>().Use<BackupService>();
            For<IForumPostingService>().LifecycleIs(Lifecycles.GetLifecycle(InstanceScope.Singleton)).Use<ForumPostingService>();
            For<IForumFormatter>().Use<phpBBFormatter>();
            For<IPublishingService>().Use<Publisher>();
            For<IExportService>().Use<ExporterService>();
        }
    }
}
